﻿$.extend({
    aming: {
        api: {
            version: "1.0.0.0",
            list: function (callback) {
                $.ajax({
                    type: "GET",
                    dataType: "jsonp",
                    url: "http://api.aming.co/keyvalue",
                    success: callback
                });
            },
            get: function (key, callback) {
                $.ajax({
                    type: "GET",
                    dataType: "jsonp",
                    url: "http://api.aming.co/keyvalue/get",
                    data: {
                        key: key
                    },
                    success: callback
                });
            },
            exist: function (key, callback) {
                $.ajax({
                    type: "GET",
                    dataType: "jsonp",
                    url: "http://api.aming.co/keyvalue/exist",
                    data: {
                        key: key
                    },
                    success: callback
                });
            },
            value: function (key, callback) {
                $.ajax({
                    type: "GET",
                    dataType: "jsonp",
                    url: "http://api.aming.co/keyvalue/value",
                    data: {
                        key: key
                    },
                    success: callback
                });
            },
            add: function (key, val, callback) {
                $.ajax({
                    type: "POST",
                    dataType: "jsonp",
                    url: "http://api.aming.co/keyvalue/add",
                    data: {
                        key: key,
                        value: val
                    },
                    success: callback
                });
            },
            update: function (key, val, callback) {
                $.ajax({
                    type: "POST",
                    dataType: "jsonp",
                    url: "http://api.aming.co/keyvalue/update",
                    data: {
                        key: key,
                        value: val
                    },
                    success: callback
                });
            },
            addorupdate: function (key, val, callback) {
                $.ajax({
                    type: "POST",
                    dataType: "jsonp",
                    url: "http://api.aming.co/keyvalue/addorupdate",
                    data: {
                        key: key,
                        value: val
                    },
                    success: callback
                });
            },
            delete: function (key, callback) {
                $.ajax({
                    type: "POST",
                    dataType: "jsonp",
                    url: "http://api.aming.co/keyvalue/delete",
                    data: {
                        key: key
                    },
                    success: callback
                });
            }
        }
    }
});